////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: ParameterParser V1.1.4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  aecconvergence.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "aecconvergence.h"
#include "parametersetmanager.h"

AECCONVERGENCE_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECCoreConvergenceTypeClass::AECCoreConvergenceTypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, 0, 0, 0, 0)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(algoSelect);
    PARAMETER_INITIALIZE(fastConv);
    PARAMETER_INITIALIZE(slowConv);
    PARAMETER_INITIALIZE(unitStepSize);
    PARAMETER_INITIALIZE(enableConvergeGainFirst);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECCoreConvergenceTypeClass::AECCoreConvergenceTypeClass(
    const CHAR* name,
    UINT32 modeId,
    UINT16 mode,
    UINT16 subMode,
    UINT32 group)
    : ParameterModule(name, MAJOR, MINOR, PATCH, modeId, mode, subMode, group)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(algoSelect);
    PARAMETER_INITIALIZE(fastConv);
    PARAMETER_INITIALIZE(slowConv);
    PARAMETER_INITIALIZE(unitStepSize);
    PARAMETER_INITIALIZE(enableConvergeGainFirst);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECCoreConvergenceTypeClass::~AECCoreConvergenceTypeClass()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* AECCoreConvergenceTypeClass::GetName(
    const CHAR* type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ParameterFileSymbolTableEntry::GetType(temp, "Convergence")) == 0)
    {
        name = "Convergence";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load SlowConvHoldTimeType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AECCoreConvergenceTypeClass::LoadSlowConvHoldTimeType(
    ParameterFileSymbolTableEntry* entry,
    SlowConvHoldTimeType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enableHoldTime);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->thresAbsExpDelta);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->expDeltaBasedHTAdjFactor);
    result = result && entry->ReadInt32(&structure->tolAdjFactor);
    result = result && entry->ReadFloat(&structure->holdTimeEnterDelay);
    result = result && entry->ReadFloat(&structure->maxHoldTime);
    result = result && entry->ReadBoolean(&structure->enableGyroBasedHT);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->thresGyroMagnitude);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->gyroBasedHTAdjFactor);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load SlowConvType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AECCoreConvergenceTypeClass::LoadSlowConvType(
    ParameterFileSymbolTableEntry* entry,
    SlowConvType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->tolMultUnitStepSize);
    structure->frameSkipMethod = (aecglobalelements::ConvFrameSkipType)entry->ReadEnum(&result);
    result = result && entry->ReadFloat(&structure->stepFactorWhenFrameSkipEnabled);
    result = result && entry->ReadFloat(&structure->convSpeed);
    result = result && entry->ReadFloat(&structure->refFrameRate);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->stepRegular);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->stepDark);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->stepBright);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->thresSlowDownAbsExpIndexDeltaDark);
    result = result && aecglobalelements::aecglobalelementsClass::LoadStartEndType(entry, &structure->thresSlowDownAbsExpIndexDeltaBright);
    result = result && entry->ReadFloat(&structure->maxRawStepAdj);
    result = result && entry->ReadFloat(&structure->tolExpIndexDeltaForceAdj);
    result = result && entry->ReadFloat(&structure->thresNumBrightRgn);
    result = result && entry->ReadFloat(&structure->thresNumDarkRgn);
    result = result && LoadSlowConvHoldTimeType(entry, &structure->holdTimeTuning);
    result = result && entry->ReadFloat(&structure->ADRCConvSpeed);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FastConvType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AECCoreConvergenceTypeClass::LoadFastConvType(
    ParameterFileSymbolTableEntry* entry,
    FastConvType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->tolMultUnitStepSize);
    structure->frameSkipMethod = (aecglobalelements::ConvFrameSkipType)entry->ReadEnum(&result);
    result = result && entry->ReadFloat(&structure->aggressiveness);
    result = result && entry->ReadBoolean(&structure->enableBrightDarkSpeedAdj);
    result = result && entry->ReadFloat(&structure->darkRatioAdjStrength);
    result = result && entry->ReadFloat(&structure->brightRatioAdjStrength);
    result = result && entry->ReadFloat(&structure->thresDarkExpIndexDelta);
    result = result && entry->ReadFloat(&structure->thresBrightExpIndexDelta);
    result = result && entry->ReadFloat(&structure->ADRCConvSpeed);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AECCoreConvergenceType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AECCoreConvergenceTypeClass::LoadAECCoreConvergenceType(
    ParameterFileSymbolTableEntry* entry,
    AECCoreConvergenceType* structure)
{
    BOOL result = TRUE;
    result = result && Loadmodule_versionStruct(entry, &structure->module_version);
    structure->algoSelect = (aecglobalelements::AECConvAlgoType)entry->ReadEnum(&result);
    result = result && LoadFastConvType(entry, &structure->fastConv);
    result = result && LoadSlowConvType(entry, &structure->slowConv);
    result = result && entry->ReadFloat(&structure->unitStepSize);
    result = result && entry->ReadBoolean(&structure->enableConvergeGainFirst);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AECCoreConvergenceTypeClass::Loadmodule_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    AECCoreConvergenceType::module_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);
    result = result && entry->ReadInt32(&structure->incr_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Parse symbol table entry, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* AECCoreConvergenceTypeClass::Parse(
    ParameterSetManager* manager,
    ParameterFileSymbolTableEntry* entry) const
{
    AECCoreConvergenceTypeClass* cls = NULL;

    if (PARAMETER_STRCMP(Type, entry->Type) == 0 && Major == entry->Major &&
        Minor == entry->Minor && Patch == entry->Patch)
    {
        cls = PARAMETER_NEW AECCoreConvergenceTypeClass(GetName(entry->Type), 
            entry->ModeId, entry->Mode, entry->SubMode, entry->Group);
        if (cls != NULL)
        {
            BOOL result = TRUE;

            cls->SymbolTableID = entry->ID;
            cls->ID            = entry->ID;

            result = result && LoadAECCoreConvergenceType(entry, cls);

            if (!result)
            {
                PARAMETER_DELETE cls;
                cls = NULL;
            }
        }
    }
    return (ParameterModule*)cls;
}


AECCONVERGENCE_NAMESPACE_END
